 package com.gmrz.uaf.protocol.v1.json;
 
 import com.google.gson.InstanceCreator;
 import com.google.gson.JsonDeserializationContext;
 import com.google.gson.JsonDeserializer;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonParseException;
 import com.google.gson.JsonSerializationContext;
 import com.google.gson.JsonSerializer;
 import com.gmrz.uaf.protocol.v1.schema.KeyID;
 import com.gmrz.util.Convert;
 import java.lang.reflect.Type;
 
 public class KeyIDAdapter
   implements InstanceCreator<KeyID>, JsonSerializer<KeyID>, JsonDeserializer<KeyID>
 {
   public KeyID createInstance(Type type)
   {
     return new KeyID();
   }
 
   public JsonElement serialize(KeyID src, Type typeofSrc, JsonSerializationContext context)
   {
     return context.serialize(Convert.toBase64(src.getId()));
   }
 
   public KeyID deserialize(JsonElement json, Type typeofT, JsonDeserializationContext context)
     throws JsonParseException
   {
     return new KeyID().withId(Convert.fromBase64(json.getAsString()));
   }
 }
